///////////////////////////////////////////////////////////////////////////////
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
///////////////////////////////////////////////////////////////////////////////
using System;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Composite.Regions;
using Microsoft.Practices.Unity;

using DominionModule.Views;
using DominionModule.ViewModels;
using DominionModule.Controllers;
using DominionModule.Services;

using Dominion;

namespace DominionModule
{
    public class ModuleInit : IModule
    {
        private readonly IUnityContainer _container;
        private readonly IRegionManager _regionManager;
        private Controller1 _controller;

        public ModuleInit(IUnityContainer container, IRegionManager regionManager)
        {
            _container = container;
            _regionManager = regionManager;

            IRegion region = _regionManager.Regions["BottomLeftRegion"];

            UniformCardStackView TestStack = new UniformCardStackView(new CardStack(Card.TestTreasureCard(), 100));
            region.Add(TestStack);
            region.Activate(TestStack);
        }

        #region IModule Members

        public void Initialize()
        {
            // Register the DataService concrete type with the container.
            // Change this to swap in another data service implementation.
            _container.RegisterType<IDataService, DataService>();

            // Display the View in the Shell. Uses Prism's 'View
            // Discovery' mechanism to automatically display the view
            // in the specified named region.
            //_regionManager.RegisterViewWithRegion("TopLeftRegion", () => _container.Resolve<View1>());

            // Create the controller.
            _controller = _container.Resolve<Controller1>();
        }

        #endregion
    }
}
